package com.lightsaber.trade.as.service.planning;

import java.util.List;
import java.util.Map;

import org.springside.modules.orm.Page;

import com.lightsaber.trade.as.entity.category.Category;
import com.lightsaber.trade.as.entity.category.CategoryNode;
import com.lightsaber.trade.as.entity.planning.Level1Planning;
import com.lightsaber.trade.as.entity.planning.Planning;
import com.lightsaber.trade.as.entity.planning.PlanningLevel;
import com.lightsaber.trade.core.service.BaseService;

public interface PlanningService extends BaseService<Planning, String> {

    @Override
    public void save(Planning planning);

    public Planning findByCategoryIdAndPlanningLevel(String categoryId, PlanningLevel planningLevel);

    /**
     * search the planning which is not archived image.
     * 
     * @param planning
     * @param page
     * @return
     */
    public Page<Planning> findPage(Planning planning, Page<Planning> page);

    /**
     * search the planning which is not archived image.
     * 
     * @param planningExercise
     *            all if null
     * @param planningLevel
     *            all if null
     * @param page
     * @return
     */
    public Page<Planning> search(Integer planningExercise, PlanningLevel planningLevel,
            Page<Planning> page);

    public void endorseFirstLevelPlanning(Category masterCategory,
            Map<CategoryNode, Level1Planning> selectedPlannings, String name, String remarks);

    public void archiveFirstLevelPlanning(Category masterCategory,
            Map<CategoryNode, Level1Planning> selectedPlannings, String name, String remarks);

    public List<Planning> findByCategoryId(String categoryId);

    public Planning findById(final String id);

}
